package com.ruoyi.web.controller.system;

import java.math.BigDecimal;
import java.util.List;

import com.ruoyi.system.domain.TmcPay;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TmcPayManage;
import com.ruoyi.system.service.ITmcPayManageService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 缴费记录Controller
 * 
 * @author ruoyi
 * @date 2021-04-23
 */
@RestController
@RequestMapping("/system/pay")
public class TmcPayManageController extends BaseController
{
    @Autowired
    private ITmcPayManageService tmcPayManageService;

    /**
     * 查询缴费记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TmcPayManage tmcPayManage)
    {
        startPage();
        List<TmcPayManage> list = tmcPayManageService.selectTmcPayManageList(tmcPayManage);
        return getDataTable(list);
    }

    /**
     * 新增缴费记录
     */
    @Log(title = "缴费记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TmcPayManage tmcPayManage)
    {
        return toAjax(tmcPayManageService.insertTmcPayManage(tmcPayManage));
    }

    /**
     * 修改缴费记录
     */
    @Log(title = "缴费记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TmcPay tmcPayManage)
    {
        return toAjax(tmcPayManageService.updateTmcPayManage(tmcPayManage));
    }
    /**
     * 获取缴费记录详细信息
     */
    @GetMapping(value = "/queryById")
    public AjaxResult getInfo( Long id)
    {
        return AjaxResult.success(tmcPayManageService.queryById(id));
    }
}
